<?php
namespace app\admin\controller;

use app\admin\model\Wechat;
use app\index\model\Home;

class WechatController extends BaseController{
	public function wechat(){
		$whereid['id']=1;
		$wechat=Wechat::where($whereid)->find();
		$this->assign('wechat',$wechat);
		return $this->fetch();
	}
	public function wechatSave(){
	    $post = input('post.');
	    $ret = Wechat::update($post);
	    if (!$ret){
	        return json(['code'=>0,'msg'=>'保存失败']);
        }
        return json(['code'=>1,'msg'=>'保存成功']);
    }

    public function home(){
	    $data = Home::get(1);
	    $this->assign('data',$data);
	    return $this->fetch();
    }

    public function homeSave(){
	    $post = input('post.');
	    Home::update($post,['id'=>1]);
	    return json(['code'=>1,'msg'=>'保存成功']);
    }



}